//获取url
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"strings"
)

func main() {
	for _, url := range os.Args[1:] {
		//给没有http的加上
		if !strings.HasPrefix(url, "http") {
			url = "http://" + url
		}
		resp, err := http.Get(url)
		if err != nil {
			fmt.Fprintf(os.Stderr, "err: %v \n", err)
			os.Exit(1)
		}
		fmt.Printf(resp.Status)
		b, err := ioutil.ReadAll(resp.Body)
		resp.Body.Close()
		if err != nil {
			fmt.Fprintf(os.Stderr, "reading err:%s：%v", url, err)
			os.Exit(1)
		}
		fmt.Printf("%s", b)
	}
}
